package com.wxyzz.satserver.user.controller;

import com.wxyzz.common.core.annotation.NoLoginCheck;
import com.wxyzz.common.core.common.R;
import com.wxyzz.satserver.user.param.LoginParam;
import com.wxyzz.satserver.user.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * --- 代码敲烂 月薪过万 ---
 *
 * @author zhouhaoyu
 * @date 2024/11/14
 * @desc
 */
@RestController
@RequestMapping("/user")
@Api(tags ="登录api")
@CrossOrigin
public class LoginController {

    @Resource
    private LoginService loginService;

    @NoLoginCheck
    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public R login(@RequestBody LoginParam loginParam,HttpServletRequest req){
        String token = loginService.login(loginParam,req);
        return R.ok(token);

    }

}
